﻿using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.Schema;

namespace ScormModel
{
    [Serializable()]
    public class RandomizationControls
    {
        private string _randomizationTiming ;
        private string _selectCount;
        private string _reorderChildren;
        private string _selectionTiming ;
          [NonSerialized]
        private XmlNode _randomizationControlsContent;
        [XmlAttribute("randomizationTiming")]
        public string RandomizationTiming
        {
            get { return this._randomizationTiming; }
            set { this._randomizationTiming = value; }
        }
        [XmlAttribute("selectCount")]
        public string SelectCount
        {
            get { return this._selectCount; }
            set { this._selectCount = value; }
        }
        [XmlAttribute("reorderChildren")]
        public string ReorderChildren
        {
            get { return this._reorderChildren; }
            set { this._reorderChildren = value; }
        }
        [XmlAttribute("selectionTiming")]
        public string SelectionTiming
        {
            get { return this._selectionTiming; }
            set { this._selectionTiming = value; }
        }
       
        [XmlIgnoreAttribute]
        public XmlNode RandomizationControlsContent
        {
            get { return this._randomizationControlsContent; }
            set { this._randomizationControlsContent = value; }
        }
        public void buildRandomizationControls()
        {
            XmlAttributeCollection attList = _randomizationControlsContent.Attributes;
            if (attList.GetNamedItem("randomizationTiming") != null)
            {
                _randomizationTiming = ((XmlAttribute)attList.GetNamedItem("randomizationTiming")).Value;
            }
            if (attList.GetNamedItem("selectCount") != null)
            {
                _selectCount = ((XmlAttribute)attList.GetNamedItem("selectCount")).Value;
            }
            if (attList.GetNamedItem("reorderChildren") != null)
            {
                _reorderChildren = ((XmlAttribute)attList.GetNamedItem("reorderChildren")).Value;
            }
            if (attList.GetNamedItem("selectionTiming") != null)
            {
                _selectionTiming = ((XmlAttribute)attList.GetNamedItem("selectionTiming")).Value;
            }
        }

    }
}
